let uid = 0
let queue = []
const Dialog = function (options) {
    options = options || {}

    const dialogTmp = Vue.extend({
        props: {
            msg: String
        },
        render(h) {
            return h('div', {
                class: ['mask']
            }, [
                h('div', {
                    class: ['dialog', `dialog_${uid}`]
                }, [
                    this.msg,
                ])
            ])
        }
    })

    const dialog = new dialogTmp({
        propsData: options
    }).$mount()
    dialog.id = uid ++

    document.body.appendChild(dialog.$el)
    queue.push(dialog)

    Dialog.closeAll = function () {
        // while(queue.length > 0) {
        //     let current = queue.pop()
        //     document.body.removeChild(current.$el)
        //     // current.$destroy()
        // }
    }
}

export default Dialog